The values in the calculation fields are calculated from mathematical
expressions specified by you. An expression consists of numerical constants,
variables, operators and functions.
|
Variables
|
Variables are values of other fields in the same record.
You can use following field types for variables:
Integer, Real number, Boolean, Currency, Calculation
Variable must be enclosed by a pound sign and open brace #{ and a closed brace }.
i.e. expression = "#{field_name1} + #{field_name2}"
|
Operators
|
The following operators are supported:
- ( open parentheses
- ) closed parentheses
- + addition
- - subtraction
- * multiplication
- / division
- % modulus
|
Examples
|
Example 1:
Entries contain fields: Price, Count
We add a calculating field "Sum" by using the following expression:
#{Price}*#{Count}
Example 2:
Entries contain fields: Count, Total
We add a calculating field "Percentage" by using the following expression:
(#{Count } / #{ Total }) * 100
|
Notes
|
Variable names can not break any of the following rules:
- can not start with a number
- can not contain an operator (see the above list of operators)
- can not contain a quote character - single or double
- can not contain a brace character - open or closed
- can not contain one of the following special characters: #, ~ , ^ !
Notes on expression parsing:
- Spaces are ignored when parsing expressions.
- The expression is evaluated as one or more subexpressions.
Subexpressions within open parentheses and closed parentheses are evaluated
before other parts of the expression.
- Subexpressions at the same level are evaluated from left to right.
- Operators with with the same precedence are evaluated from left to right.
|